<template>
  <div class="basic-options">
    <div class="table-head">
      <div class="table-title" v-for="(item, index) in head" :key="index">
        {{ item.name }}
      </div>
    </div>
    <div class="table-body">
      <div class="table-row" v-for="(t, i) in options" :key="`row-${i}`">
        <div
          class="table-column"
          :class="`table-column-${n}`"
          v-for="(m, n) in head"
          :key="n"
        >
          <span>{{ t[m.prop] }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "BasicOptions",
  props: {
    options: {
      type: Array,
      default: () => [],
    },
  },
  data() {
    return {
      head: [
        {
          name: "方法名",
          prop: "name",
        },
        {
          name: "说明",
          prop: "desc",
        },
        {
          name: "参数",
          prop: "option",
        },
      ],
    };
  },
};
</script>

<style scoped lang="scss">
.basic-options {
  font-size: 14px;
  padding: 0 25px;
  margin: 15px 0;
  .table-head {
    display: grid;
    grid-template-columns: 25% 45% 30%;
    padding: 10px 0;
    font-weight: 700;
    border-bottom: 1px solid #ccc;
  }
  .table-body {
    font-size: 14px;
    .table-row {
      display: grid;
      grid-template-columns: 25% 45% 30%;
      padding: 10px 0;
      border-bottom: 1px solid #f0f0f0;
      .table-column-0 {
        span {
          color: #c7254e;
          background-color: #f9f2f4;
          border-radius: 4px;
          padding: 0 3px;
        }
      }
      .table-column-2 {
        color: #666;
      }
    }
  }
}
</style>
